package com.qkjia.srb.core;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.Environment;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * @author 赵乾坤
 * @since 2021-11-01
 */
@SpringBootApplication
@ComponentScan({"com.qkjia.srb","com.qkjia.common"})// 扫描所有的com.qkjia.srb模块 ,"com.qkjia.common"为了扫描全局异常
@Slf4j
public class ServiceCoreApplication {
    public static void main(String[] args) throws UnknownHostException {

//        SpringApplication.run(ServiceCoreApplication.class, args);
        ConfigurableApplicationContext applicationContext = SpringApplication.run(ServiceCoreApplication.class, args);
        Environment env = applicationContext.getEnvironment();
        log.info("\n----------------------------------------------------------\n\t" +
                        "(♥◠‿◠)ﾉﾞ  系统服务启动成功   ლ(´ڡ`ლ):\n\t" +
                        "Swagger文档: \t\thttp://{}:{}{}{}/doc.html\n" +
                        "----------------------------------------------------------",
                InetAddress.getLocalHost().getHostAddress(),
                env.getProperty("server.port", "8080"),
                env.getProperty("server.servlet.context-path", ""),
                env.getProperty("spring.mvc.servlet.path", ""));
    }
}